package models

import (
	"github.com/astaxie/beego/orm"
)

type User struct {
	Id       int    `pk;column(id);auto"`
	Username string `orm:"size(50); column(username)"`
	Password string `orm:"size(50); column(password)"`
}

func (user *User) Authenticate() bool {
	var result []orm.Params
	GetOrm().Raw("select * from user where username=? and password=?", user.Username, user.Password).Values(&result)
	if len(result) == 0 {
		return false
	}
	return true
}
